package org.example.guide.service;

import org.example.guide.domain.Guide;
import org.example.guide.domain.Transaction;
import org.example.guide.persistence.transactionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class transactionService {
    @Autowired
    transactionMapper transactionMapper;
    public List<Transaction> selectAllUpgrade(){
        return transactionMapper.selectAllUpgrade();
    }
    public List<Transaction> selectAllRegister(){
        return transactionMapper.selectAllRegister();
    }
    public List<Transaction> selectAllReport(){
        return transactionMapper.selectAllReport();
    }
    public List<Transaction> selectAllApply(){
        return transactionMapper.selectAllApply();
    }
    public void passUpgrade(int id,int GuideID,String Qualification){
        transactionMapper.deleteById(id);
        transactionMapper.updateQualification(GuideID,Qualification);
    }
    public void passRegister(int id,int GuideID){
        transactionMapper.deleteById(id);
        transactionMapper.updateStatus(GuideID);
    }
    public Guide passReport(int id, int GuideID, int TeamID){
        transactionMapper.deleteById(id);
        transactionMapper.updateTeamID(GuideID,TeamID);
        return transactionMapper.selectGuideById(id);
    }
    public void deleteByID(int id){
        transactionMapper.deleteById(id);
    }


}
